package org.hbbTlias2025.filter;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;


//@WebFilter(urlPatterns = "/*")
@Slf4j
public class DemoFilter  implements Filter {

//    实现init方法
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("过滤器初始化");
    }
//    实现destroy方法
    @Override
    public void destroy() {
        log.info("过滤器销毁");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("过滤器开始工作,这是放行前的逻辑我去");
        filterChain.doFilter(servletRequest,servletResponse);
        log.info("过滤器工作结束,这是放行后的逻辑我giao");
    }

}
